package cn.sirun.com.fca.account.repo.pin;


import com.tencent.cloud.iov.kernel.constant.ApiConst;
import com.tencent.cloud.iov.kernel.model.BaseResponse;
import com.tencent.cloud.iov.kernel.service.ServiceGenerator;

import cn.sirun.com.fca.account.model.base.CarInfoDetailRequest;
import cn.sirun.com.fca.account.model.base.CarInfoDetailResponse;
import cn.sirun.com.fca.account.model.bind.PinCheckExistResponse;
import cn.sirun.com.fca.account.model.bind.PinSetFirstRequest;
import cn.sirun.com.fca.account.model.bind.PinSetFirstResponse;
import cn.sirun.com.fca.account.model.bind.PinSetParamResponse;
import cn.sirun.com.fca.account.model.bind.PinSetParamsRequest;
import cn.sirun.com.fca.account.model.bind.RecognizePicRequest;
import cn.sirun.com.fca.account.model.bind.RecognizePicResponse;
import cn.sirun.com.fca.account.model.bind.SubmitCarAuthenticationRequest;
import cn.sirun.com.fca.account.model.bind.SubmitCarAuthenticationResponse;
import cn.sirun.com.fca.account.model.bind.SubmitOwnerInfoRequest;
import cn.sirun.com.fca.account.model.bind.SubmitPersonalInfoRequest;
import cn.sirun.com.fca.account.model.bind.SubmitPersonalInfoResponse;
import cn.sirun.com.fca.account.model.bind.VerifyPinRequest;
import cn.sirun.com.fca.account.model.bind.VerifyPinResponse;
import cn.sirun.com.fca.account.repo.bind.BindService;
import io.reactivex.Observable;

/**
 * @author vinsonhuang
 * @date 2018/5/8
 */

public class PinRepository {

    private static volatile PinRepository sInstance;

    public static PinRepository getInstance() {
        if (sInstance == null) {
            synchronized (PinRepository.class) {
                if (sInstance == null) {
                    sInstance = new PinRepository();
                }
            }
        }

        return sInstance;
    }

    private final PinService mBindService;

    private PinRepository() {
        mBindService = ServiceGenerator.createService(PinService.class, ApiConst.getBaseUrl());
    }


    public Observable<BaseResponse<PinSetParamResponse>> getPinSetParams(PinSetParamsRequest request) {
        return mBindService.getPinSetParams(request);
    }

    public Observable<BaseResponse<PinSetFirstResponse>> pinSetFirst(PinSetFirstRequest request) {
        return mBindService.pinSetFirst(request);
    }


    public Observable<BaseResponse<PinSetParamResponse>> getUpdatePinSetParams(PinSetParamsRequest request) {
        return mBindService.getUpdatePinSetParams(request);
    }

    public Observable<BaseResponse<VerifyPinResponse>> verifyPin(VerifyPinRequest request) {
        return mBindService.verifyPin(request);
    }

    public Observable<BaseResponse<PinSetFirstResponse>> pinReset(PinSetFirstRequest request) {
        return mBindService.pinReset(request);
    }

    public Observable<BaseResponse<PinCheckExistResponse>> pinCheckExist() {
        return mBindService.checkPinExist();
    }
}
